package nc.ui.ic.m4q.source;

import java.awt.Container;

import nc.pub.m4q.cons.DefFieldCons;
import nc.ui.pub.pf.BillSourceDLG;
import nc.ui.pub.pf.BillSourceVar;

public class M45SourceDLG extends BillSourceDLG{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	public M45SourceDLG(Container parent, BillSourceVar bsVar) {
		super(parent, bsVar);
	}

	@Override
	public String getHeadCondition() {
		return "not exists (\r\n" + 
				"  select 1 from (\r\n" + 
				"  select cgeneralhid hid, sum((case when isnull(ic_purchasein_b."+DefFieldCons.M45_BODY_TOTOALM4QNUM+", '~')='~' then 0 else TO_NUMBER(ic_purchasein_b."+DefFieldCons.M45_BODY_TOTOALM4QNUM+") end)) nbodynum from ic_purchasein_b where dr=0 group by cgeneralhid\r\n" + 
				"  ) ttt where ttt.hid=cgeneralhid and ttt.nbodynum = ntotalnum\r\n" + 
				")";
	}
	
	@Override
	public String getBodyCondition() {
		return "nnum <> (case when isnull(ic_purchasein_b."+DefFieldCons.M45_BODY_TOTOALM4QNUM+", '~')='~' then 0 else TO_NUMBER(ic_purchasein_b."+DefFieldCons.M45_BODY_TOTOALM4QNUM+") end)";
	}
}
